using System;
using Technullogy.Web.UI.TwcWeather;

namespace Technullogy.Web.UI.Weather.TechnullogyWeather
{
    // Main weather information class
    internal class WeatherOutlook
    {
        public String Locale { get; set; }
        public String Location { get; set; }
        public String LocalTime { get; set; }
        public String LastUpdate { get; set; }
        public decimal Latitude { get; set; }
        public decimal Longitude { get; set; }
        public String Timezone { get; set; }
        public String ObservationStation { get; set; }
        public String Sunrise { get; set; }
        public String Sunset { get; set; }
        public String Description { get; set; }
        public String Humidity { get; set; }
        public String Icon { get; set; }
        public String Temperature { get; set; }
        public String WindChill { get; set; }
        public decimal Visibility { get; set; }
        public String Dewpoint { get; set; }

        private Barometer _barometer = new Barometer();
        public Barometer Barometer
        {
            get { return _barometer; }
            set { _barometer = value; }
        }

        private UV _uv = new UV();
        public UV UV
        {
            get { return _uv; }
            set { _uv = value; }
        }

        private Wind _wind = new Wind();
        public Wind Wind
        {
            get { return _wind; }
            set { _wind = value; }
        }

        private Moon _moon = new Moon();
        public Moon Moon
        {
            get { return _moon; }
            set { _moon = value; }
        }

        private Metrics _units = new Metrics();
        public Metrics Units
        {
            get { return _units; }
            set { _units = value; }
        }

        public WeatherOutlook(weather twcData)
        {
            Units.Distance = twcData.head.ud;
            Units.Precipitation = twcData.head.ur;
            Units.Pressure = twcData.head.up;
            Units.Speed = twcData.head.us;
            Units.Temperature = twcData.head.ut;
            Locale = twcData.head.Locale;
            Location = twcData.loc.dnam;
            LocalTime = twcData.loc.tm;
            LastUpdate = twcData.cc.lsup;
            Latitude = twcData.loc.lat;
            Longitude = twcData.loc.lon;
            Timezone = twcData.loc.zone;
            ObservationStation = twcData.cc.obst;
            Sunrise = twcData.loc.sunr;
            Sunset = twcData.loc.suns;
            Description = twcData.cc.t;
            Humidity = twcData.cc.hmid;
            Icon = twcData.cc.icon;
            Temperature = twcData.cc.tmp;
            WindChill = twcData.cc.flik;
            Barometer.Direction = twcData.cc.bar.d;
            Barometer.Reading = twcData.cc.bar.r;
            Visibility = twcData.cc.vis;
            UV.Index = twcData.cc.uv.i;
            UV.Description = twcData.cc.uv.t;
            Dewpoint = twcData.cc.dewp;
            Wind.Degrees = twcData.cc.wind.d.ToString();
            Wind.Direction = twcData.cc.wind.t;
            Wind.Gust = twcData.cc.wind.gust;
            Wind.Speed = twcData.cc.wind.s.ToString();
            Moon.Description = twcData.cc.moon.t;
            Moon.Icon = twcData.cc.moon.icon;
            Barometer.Reading = twcData.cc.bar.r;
            Barometer.Direction = twcData.cc.bar.d;
        }
    }
}
